import requests


API_KEY = "oMlYVBgANplqH7XilK0rzJ47r7p1R3MWoywVNBYOGvj5UHYXebQnxZjX9kLpdd5V"
SECRET_KEY = "8587vRjV45QsPPXhlrn3vcBdUwQJFA6HIBqfaVbJO7UqhhqTcVrQCR4GEO6w4OtN"

def get_all_margin_assets():
    base_url = 'https://api.binance.com'
    endpoint = '/sapi/v1/margin/allAssets'
    # 准备请求头
    headers = {
        'X-MBX-APIKEY': API_KEY
    }
    # 发送请求
    response = requests.get(base_url + endpoint, headers=headers)

    if response.status_code == 200:
        return response.json()
    else:
        print(f"Error: {response.status_code}, {response.text}")
        return None


# 使用示例
if __name__ == "__main__":
    assets_info = get_all_margin_assets()
    print("Margin Assets Information:")
    for asset in assets_info:
        print(asset)
        # if 'interestRate' in asset:
        #     print(f"Asset: {asset['assetName']}, Interest Rate: {asset.get('interestRate', 'N/A')}")